import request from "@/utils/request";

// 获取投诉列表
export function getComplaintList(params) {
	return request({
		url: "/complaint",
		method: "get",
		params,
	});
}

// 获取投诉详情
export function getComplaintDetail(id) {
	return request({
		url: `/complaint/${id}`,
		method: "get",
	});
}

// 提交投诉
export function createComplaint(data) {
	return request({
		url: "/complaint",
		method: "post",
		data,
	});
}

// 处理投诉
export function processComplaint(id, data) {
	return request({
		url: `/complaint/${id}/process`,
		method: "put",
		data,
	});
}

// 获取投诉统计信息
export function getComplaintStatistics() {
	return request({
		url: "/complaint/statistics",
		method: "get",
	});
}

// 回复投诉
export function replyComplaint(id, data) {
	return request({
		url: `/complaint/${id}/process`,
		method: "put",
		data: {
			status: "Processed",
			response: data.reply,
		},
	});
}
